import axios from "axios";
import { Message } from "element-ui";

const http = axios.create({
    baseURL: 'api',
    timeout: 100000
});

http.interceptors.request.use(function (config) {
    return config;
}, function (error) {
    return Promise.reject(error);
});




http.interceptors.response.use(function (response) {

    if(response.data.code == 500){
        Message.error(response.data.msg)
    }
    
    return response.data;
}, function (error) {
    return Promise.reject(error);
});


export default http;